using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class level5TriggerMan : MonoBehaviour
{
    static public level5TriggerMan ins;
    public int num;

    void Awake()
    {
        ins = this;
    }

    void OnTriggerEnter2D(Collider2D x)
    {
        if (x.CompareTag("Player"))
        {
            if (x.gameObject.GetComponent<SimpleRocket>()._isGhost)
            {
                Destroy(x.gameObject);
                return;
            }
            if (ins.num > 1)
            {
                endGame.ins.victory = true;
            }
            x.gameObject.GetComponent<SimpleRocket>().desSelf();
            Invoke("defer", 1.0f);
        }
    }
    public void defer()
    {
        endGame.ins.endgame();
    }
}
